#include <iostream>
#include <cstdio>
using namespace std;
long long n,a[100300],s=0;
void kpl(int l,int r)
{
	int i=l,j=r,mid=a[(i+j)/2];
	while (i<=j)
	{
		while (a[i]>mid)
			i++;
		while (a[j]<mid)
			j--;
		if (i<=j)
		{
			swap(a[i],a[j]);
			i++,j--;
		}
	}
	if (i<r)
		kpl(i,r);
	if (l<j)
		kpl(l,j);
}
int main ()
{
	freopen("buy.in","r",stdin);
	freopen("buy.out","w",stdout);
	cin>>n;
	for (int i=1;i<=n;i++)
		cin>>a[i];
	kpl(1,n);
	for (int i=1;i<=n;i++)
	{
		s+=a[i]+a[i+1];
		i+=2;
	}
	cout<<s;
	return 0;
}